<template>
    <el-button type="text" @click="dialogTableVisible = true">添加设备</el-button>
    <el-dialog title="添加设备" :visible.sync="dialogTableVisible" width="50%">
        <el-form :model="params">
            <el-form-item label="设备名称" :label-width="formLabelWidth">
                <el-input v-model="params.detail" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="设备编号" :label-width="formLabelWidth">
                <el-input v-model="params.equipmentNo" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="序列号" :label-width="formLabelWidth">
                <el-input v-model="params.equipmentNo" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="类别" :label-width="formLabelWidth">
                <el-select v-model="params.type" placeholder="选择使用类型">
                    <el-option label="家用" value="1"></el-option>
                    <el-option label="商用" value="2"></el-option>
                </el-select>
            </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="dialogTableVisible = false">取 消</el-button>
            <el-button type="primary" @click="adDevice">确 定</el-button>
        </div>
    </el-dialog>
</template>
<script>
import { Message } from 'element-ui'
export default {
    name: '',
    components: {

    },
    mixins: [],
    props: {

    },
    data() {
        return {

            dialogTableVisible: false,

            params: {
                "addr": "",//安装地点
                "addrDetail": "",//详细地址
                "detail": "",//中文名称 1
                "equipmentNo": "",//设备编号 1
                "imei": "", //国际移动设备识别码
                "lat": "",
                "lng": "",
                "mainBind": "",//主绑人
                "notes": "",//备注
                "status": "",//设备状态
                "type": ""//设备类型 1
            },
            formLabelWidth: '120px',
        }
    },
    computed: {

    },
    watch: {

    },
    mounted() {

    },
    methods: {
        adDevice() {
            // 关闭弹窗
            this.dialogTableVisible = false
            let param = JSON.stringify(this.params)
            let data = { params: param }
            AddDevice(data).then(res => {
                Message({
                    message: '添加成功',
                    type: 'success',
                    duration: 3 * 1000
                })
            })
        },
    }
};
</script>
<style lang='' scoped>
</style>